﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace ObjectModel.Excel.Old
{
	public enum ResizeActions {
    	Truncate,
    	Expand,
    	Error
    };

	public class ResizeableRange : CachedRange
	{
		public ResizeActions ResizeAction { get; set; }

        public ResizeableRange() : base() { }
        
        public ResizeableRange(Range range) : base(range) { }

		public override Range Range
		{
			get
			{
				return base.Range;
			}
			 set {
            	base.Range = value;
            	if(value.Columns.Count == 1 && value.Rows.Count == 1) {
					// If the range is a single cell - we can signify that we are happy for it to be updated in the future 
					// by a dynamic or static range with different dimensions
            		ResizeAction = ResizeActions.Expand;
            	}
            	else {
					// If not we are saying that we always want the current dimensions regardless of source size
            		ResizeAction = ResizeActions.Truncate;
            	}
            }
		}
	}
}
